package com.study.springboot2;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;

@SpringBootApplication
public class Springboot2Application extends SpringBootServletInitializer {

    //这个主程序可以在测试环境中直接用jar 进行启动（内置tomcat）
    public static void main(String[] args) {
        SpringApplication.run(Springboot2Application.class, args);
    }

    //这个可以在外部tomcat 使用, 通过war 包放在tomcat 的webapps 目录下
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application){
        System.out.println("外部tomcat,chapter启动!");
        return application.sources(Springboot2Application.class);
    }
}
